package com.youdianstar.app.common.network.model


/**
 * File: BaseResponse
 * Author: 82149 Create: 2021/9/18 14:46
 * Changes (from 2021/9/18)
 * --------------------------------------------------
 * description:
 * ---------------------------------------------------
 *
 */
class BaseResponse<T> {
    var code = -1
    var message: String? = null
    var data: T? = null
        //以下数据私有, 不用公开暴露
        private set
    var dataState: DataState? = null
    var error: Throwable? = null
    val isSuccess: Boolean
        get() = code == 0 || code == 200
    
    /**
     * 设置数据的方法，用于特殊情况下的数据设置
     */
    fun setData(data: T?) {
        this.data = data
    }
}